<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/Typescript/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/Typescript/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/Typescript/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/Typescript/images/logo.svg" color="#222">

<link rel="stylesheet" href="/Typescript/css/main.css">


<link rel="stylesheet" href="/Typescript/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"yoursite.com","root":"/Typescript/","scheme":"Muse","version":"7.7.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="兼容性要牢记一句话: ts一切都是为了安全！！！,因此不要死记硬背，要从安全性去考虑即可 如果是一个值，并且是联合类型的(如基本类型的兼容性)，从赋值方考虑，即等号右边赋值过去了，满不满足  接口的兼容性 1234567891011121314interface IPerson1 &amp;#123;    name: string;    age: number;&amp;#125;interface IPer">
<meta property="og:type" content="article">
<meta property="og:title" content="Typescript&#x2F;兼容性">
<meta property="og:url" content="http://yoursite.com/2020/11/21/Typescript/%E5%85%BC%E5%AE%B9%E6%80%A7/index.html">
<meta property="og:site_name" content="Typescript">
<meta property="og:description" content="兼容性要牢记一句话: ts一切都是为了安全！！！,因此不要死记硬背，要从安全性去考虑即可 如果是一个值，并且是联合类型的(如基本类型的兼容性)，从赋值方考虑，即等号右边赋值过去了，满不满足  接口的兼容性 1234567891011121314interface IPerson1 &amp;#123;    name: string;    age: number;&amp;#125;interface IPer">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2020-11-21T03:51:29.522Z">
<meta property="article:modified_time" content="2020-11-21T03:51:29.522Z">
<meta property="article:author" content="HC">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://yoursite.com/2020/11/21/Typescript/%E5%85%BC%E5%AE%B9%E6%80%A7/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'en'
  };
</script>

  <title>Typescript/兼容性 | Typescript</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <div>
      <a href="/Typescript/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Typescript</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/Typescript/" rel="section"><i class="fa fa-fw fa-home"></i>Home</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/Typescript/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>Archives</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="en">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2020/11/21/Typescript/%E5%85%BC%E5%AE%B9%E6%80%A7/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/Typescript/images/avatar.gif">
      <meta itemprop="name" content="HC">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Typescript">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Typescript/兼容性
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2020-11-21 11:51:29" itemprop="dateCreated datePublished" datetime="2020-11-21T11:51:29+08:00">2020-11-21</time>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="兼容性"><a href="#兼容性" class="headerlink" title="兼容性"></a>兼容性</h1><p>要牢记一句话: <strong>ts一切都是为了安全！！！</strong>,因此不要死记硬背，要从安全性去考虑即可</p>
<p><strong>如果是一个值，并且是联合类型的(如基本类型的兼容性)，从赋值方考虑，即等号右边赋值过去了，满不满足</strong></p>
<ul>
<li><p>接口的兼容性</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">interface</span> IPerson1 &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">interface</span> IPerson2 &#123;</span><br><span class="line">    name: <span class="built_in">string</span>;</span><br><span class="line">    age: <span class="built_in">number</span>;</span><br><span class="line">    sex: <span class="built_in">number</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">let</span> obj1!: IPerson1;</span><br><span class="line"><span class="keyword">let</span> obj2!: IPerson2;</span><br><span class="line"></span><br><span class="line"><span class="comment">//obj1 = obj2;  </span></span><br><span class="line">obj2 = obj1; <span class="comment">// 报错  IPerson1中没有sex, 如果赋值给了obj2, obj2.sex就会报错，因此ts编译时是不让通过的</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>基本类型的兼容性</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> BaseType1 = <span class="built_in">string</span> | <span class="built_in">number</span> | <span class="built_in">boolean</span>;</span><br><span class="line"><span class="keyword">type</span> BaseType2 = <span class="built_in">string</span> | <span class="built_in">number</span>;</span><br><span class="line"><span class="keyword">let</span> b1!: BaseType1;</span><br><span class="line"><span class="keyword">let</span> b2!: BaseType2;</span><br><span class="line"><span class="comment">// b1 = b2;</span></span><br><span class="line">b2 = b1;  <span class="comment">// 报错, b1类型本来没有boolean, b2有boolean类型，那赋给boolean类型会不接受，所以不兼容</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>类的兼容性</p>
<p>类的兼容性只考虑<strong>结构</strong>是否相同，不管两个类有没有关系，只需考虑结构是否相同即可</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">class</span> Animal &#123;</span><br><span class="line">    <span class="keyword">public</span> name: <span class="built_in">string</span> = <span class="string">'hchlq'</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">class</span> Cat <span class="keyword">extends</span> Animal &#123;</span><br><span class="line">    <span class="keyword">public</span> age: <span class="built_in">number</span> = <span class="number">2</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">let</span> t1: <span class="keyword">typeof</span> Animal = Animal;</span><br><span class="line"><span class="keyword">let</span> t2: <span class="keyword">typeof</span> Cat = Cat;</span><br><span class="line"><span class="comment">// t1 = t2;</span></span><br><span class="line">t2 = t1; <span class="comment">// 报错， 因为t1中只有name属性 t2有age,同时继承了父亲Animal，因此相当于既有name，也有age</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>函数的兼容性</p>
<ul>
<li><p>比较参数</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> fn1 = <span class="function">(<span class="params">name: <span class="built_in">string</span>, age: <span class="built_in">number</span>, sex: <span class="built_in">string</span></span>) =&gt;</span> <span class="built_in">void</span>;</span><br><span class="line"><span class="keyword">type</span> fn2 = <span class="function">(<span class="params">name: <span class="built_in">string</span>, age: <span class="built_in">number</span></span>) =&gt;</span> <span class="built_in">void</span></span><br><span class="line"><span class="keyword">let</span> t1!: fn1;</span><br><span class="line"><span class="keyword">let</span> t2!: fn2;</span><br><span class="line"><span class="comment">// t1 = t2;</span></span><br><span class="line">t2 = t1;<span class="comment">// 报错，fn1需要三个参数，但是fn2只提供两个参数，不满足fn1需要的三个参数</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>比较返回值</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> fn1 = <span class="function">(<span class="params">name: <span class="built_in">string</span>, age: <span class="built_in">number</span></span>) =&gt;</span> &#123;name: <span class="built_in">string</span>, age: <span class="built_in">number</span>&#125;;</span><br><span class="line"><span class="keyword">type</span> fn2 = <span class="function">(<span class="params">name: <span class="built_in">string</span>, age: <span class="built_in">number</span></span>) =&gt;</span> &#123;name: <span class="built_in">string</span>&#125;;</span><br><span class="line"><span class="keyword">let</span> t1!: fn1;</span><br><span class="line"><span class="keyword">let</span> t2!: fn2;</span><br><span class="line">t1 = t2; <span class="comment">// 报错， 返回值中，只能多的赋给少的，像fn1,需要两个属性的返回值，后面可能会用到，fn2只返回有一个属性，因此可能会出错。</span></span><br><span class="line"><span class="comment">// t2 = t1;</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>函数的协变和逆变</p>
<ul>
<li><p>协变: 只在同一个方向</p>
</li>
<li><p>逆变： 只在相反的方向</p>
</li>
<li><p>双向协变: 包括同一个方向和不同方向</p>
</li>
<li><p>不变: 类型不完全相同，则它们是不兼容的。</p>
</li>
<li><p>返回值类型是协变的，参数类型是逆变</p>
</li>
<li><p>参数逆变父类 返回值协变子类 <strong>搀你父,返鞋子</strong></p>
</li>
<li><p>理解: 参数可以少穿多， 返回值只能多传少，孩子继承父类，既有父亲的，也有自己的，是多的一方</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 始终牢记 "参数可以少穿多， 返回值只能多传少，孩子继承父类，既有父亲的，也有自己的，是多的一方"</span></span><br><span class="line"><span class="keyword">class</span> Animal&#123;&#125;</span><br><span class="line"><span class="keyword">class</span> Dog <span class="keyword">extends</span> Animal&#123;</span><br><span class="line">    <span class="keyword">public</span> name:<span class="built_in">string</span> = <span class="string">'Dog'</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">class</span> BlackDog <span class="keyword">extends</span> Dog &#123;</span><br><span class="line">    <span class="keyword">public</span> age: <span class="built_in">number</span> = <span class="number">10</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">class</span> WhiteDog <span class="keyword">extends</span> Dog &#123;</span><br><span class="line">    <span class="keyword">public</span> home: <span class="built_in">string</span> = <span class="string">'北京'</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">let</span> animal: Animal;</span><br><span class="line"><span class="keyword">let</span> blackDog: BlackDog;</span><br><span class="line"><span class="keyword">let</span> whiteDog: WhiteDog;</span><br><span class="line"><span class="keyword">type</span> Callback = <span class="function">(<span class="params">dog: Dog</span>)=&gt;</span>Dog;</span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">exec</span>(<span class="params">callback:Callback</span>):<span class="title">void</span></span>&#123;</span><br><span class="line">    callback(whiteDog);</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">type</span> ChildToChild = <span class="function">(<span class="params">blackDog: BlackDog</span>) =&gt;</span> BlackDog;</span><br><span class="line"><span class="keyword">const</span> childToChild: ChildToChild = (blackDog: BlackDog): <span class="function"><span class="params">BlackDog</span> =&gt;</span> blackDog</span><br><span class="line">exec(childToChild); <span class="comment">// 报错, 参数不满足</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//也不行,理由同上</span></span><br><span class="line"><span class="keyword">type</span> ChildToParent = <span class="function">(<span class="params">blackDog: BlackDog</span>) =&gt;</span> Animal;</span><br><span class="line"><span class="keyword">const</span> childToParent: ChildToParent = (blackDog: BlackDog): <span class="function"><span class="params">Animal</span> =&gt;</span> animal</span><br><span class="line">exec(childToParent); <span class="comment">// 报错， 参数和返回值都不满足</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//不行 因为有可能调用返回的Dog的方法</span></span><br><span class="line"><span class="keyword">type</span> ParentToParent = <span class="function">(<span class="params">animal: Animal</span>) =&gt;</span> Animal;</span><br><span class="line"><span class="keyword">const</span> parentToParent: ParentToParent = (animal: Animal): <span class="function"><span class="params">Animal</span> =&gt;</span> animal</span><br><span class="line">exec(parentToParent); <span class="comment">// 报错， 返回值不满足</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">type</span> ParentToChild = <span class="function">(<span class="params">animal: Animal</span>) =&gt;</span> BlackDog;</span><br><span class="line"><span class="keyword">const</span> parentToChild: ParentToChild = (animal: Animal): <span class="function"><span class="params">BlackDog</span> =&gt;</span> blackDog</span><br><span class="line">exec(parentToChild); <span class="comment">// 可以，参数的返回值都满足</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>看一下参数只有一个，类型是联合类型的情况</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">type</span> Fn1 = <span class="function">(<span class="params">name: <span class="built_in">string</span> | <span class="built_in">number</span> | <span class="built_in">boolean</span></span>) =&gt;</span> <span class="built_in">void</span>; <span class="comment">// void表示使用这个类型的函数不关心返回值</span></span><br><span class="line"><span class="keyword">type</span> Fn2 = <span class="function">(<span class="params">name: <span class="built_in">string</span> | <span class="built_in">number</span></span>) =&gt;</span> <span class="built_in">void</span>;</span><br><span class="line"><span class="keyword">let</span> fn1!: Fn1;</span><br><span class="line"><span class="keyword">let</span> fn2!: Fn2;</span><br><span class="line">fn1 = fn2; <span class="comment">// 报错，因为fn1可能是string, number或者boolean, 但是fn2只有string, number, 如果fn1是boolean, 那么fn2是接受不了的</span></span><br><span class="line"><span class="comment">//fn2 = fn1;</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>泛型的兼容性</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 1 如果接口内容为空，可以</span></span><br><span class="line"><span class="keyword">interface</span> IT1&lt;T&gt; &#123;&#125;</span><br><span class="line"><span class="keyword">interface</span> IT2&lt;T&gt; &#123;&#125;;</span><br><span class="line"><span class="keyword">let</span> t1!:IT1&lt;<span class="built_in">number</span>&gt;;</span><br><span class="line"><span class="keyword">let</span> t2!: IT2&lt;<span class="built_in">string</span>&gt;;</span><br><span class="line">t2 = t1; <span class="comment">// t1 = t2都行</span></span><br><span class="line"> </span><br><span class="line"><span class="comment">//-------------</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//如果接口内容有值，看类型是否相同</span></span><br><span class="line"><span class="keyword">interface</span> IT1&lt;T&gt; &#123;</span><br><span class="line">    name: T</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">interface</span> IT2&lt;T&gt; &#123;</span><br><span class="line">    name: T</span><br><span class="line">&#125;;</span><br><span class="line"><span class="keyword">let</span> t1!:IT1&lt;<span class="built_in">number</span>&gt;;</span><br><span class="line"><span class="keyword">let</span> t2!: IT2&lt;<span class="built_in">string</span>&gt;;</span><br><span class="line">t2 = t1; <span class="comment">// 报错  如果IT2为number的话，就通过</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>枚举类型</p>
<p>枚举类型和数字类型兼容</p>
<figure class="highlight ts"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> e!:Color;</span><br><span class="line">e = Color.red;</span><br><span class="line">e = <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">let</span> num:<span class="built_in">number</span> = <span class="number">0</span>;</span><br><span class="line">num = Color.red;</span><br></pre></td></tr></table></figure>

</li>
</ul>

    </div>

    
    
    

      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/Typescript/2020/11/21/Typescript/typescript%E5%AE%9A%E4%B9%89/" rel="prev" title="Typescript/typescript定义">
      <i class="fa fa-chevron-left"></i> Typescript/typescript定义
    </a></div>
      <div class="post-nav-item">
    <a href="/Typescript/2020/11/21/Typescript/%E5%87%BD%E6%95%B0/" rel="next" title="Typescript/函数">
      Typescript/函数 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#兼容性"><span class="nav-number">1.</span> <span class="nav-text">兼容性</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">HC</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/Typescript/archives/">
        
          <span class="site-state-item-count">12</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">HC</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> v4.2.1
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">Theme – <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> v7.7.2
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/Typescript/lib/anime.min.js"></script>
  <script src="/Typescript/lib/velocity/velocity.min.js"></script>
  <script src="/Typescript/lib/velocity/velocity.ui.min.js"></script>

<script src="/Typescript/js/utils.js"></script>

<script src="/Typescript/js/motion.js"></script>


<script src="/Typescript/js/schemes/muse.js"></script>


<script src="/Typescript/js/next-boot.js"></script>




  















  

  

</body>
</html>
